<template>
  <h2>今年 ：{{age}}</h2>
  <h2>5年后 ：{{newAge}}</h2>
  <input type="text" v-model="newAge" />
</template>

<script>
import { computed, ref } from "vue";
export default {
  setup() {
    const age = ref(18);

    const newAge = computed({
      get() {
        return age.value + 5;
      },
      set(val) {
        console.log(val);
        age.value = val - 5;
      },
    });


    return { age, newAge };
  },
};
</script>

<style>
</style>